var wrapper = new Vue({
		el:"#wrapper",
		data:{
			email: '未登录',
			result: '',
			logon: true,
			hot: '',
			user: '',
			uname: '',
			uemail: '',
			ucontent: '',
		},
		methods:{
			getEmail:function(){
				var emil1 = sessionStorage.getItem("email");
				if(emil1 != null){
					this.email = emil1;
					this.logon = !this.logon;
				}
			},
			logout:function(){
				sessionStorage.removeItem("email");
				sessionStorage.removeItem("uuid");
				window.location.reload();
			},
			getHot:function(){
				var that = this;
				axios.get(base_ure+'/essay/hot').then(function(res){
				    if(res.data.code == "200")
				    {
				        that.hot = res.data.data;
				    }
					else{
						alert(res.data.msg);
					}
				},function(err){
				    alert("网络出错！");
				})
			},
			getUser:function(){
				var that = this;
				axios.get(base_ure+'/user/getUser').then(function(res){
				    if(res.data.code == "200")
				    {
				        that.user = res.data.data;
				    }
					else{
						alert(res.data.msg);
					}
				},function(err){
				    alert("网络出错！");
				})
			},
			getWord:function(){
				var that = this;
				axios.get(base_ure+'/word/getW').then(function(res){
				    if(res.data.code == "200")
				    {
				        that.result = res.data.data;
				    }
					else{
						alert(res.data.msg);
					}
				},function(err){
				    alert("网络出错！");
				})
			},
			addWord:function(){
				var that = this;
				axios.post(base_ure+'/word/say', {
				    email: that.uemail,
					username: that.uname,
					content: that.ucontent,
				})
				.then(function (response) {
					 console.log(response);
					 if(response.data.code == "200"){
						 that.uemail = '';
						 that.uname = '';
						 that.ucontent = '';
						 that.getWord();
					 }else{
						 alert("加入失败，请重试！");
						 return false;
					 }
				})
				.catch(function (error) {
				 console.log(error);
				 alert("出错了，请重试！");
				});
			},
		},
		mounted() {
			
		},
		created(){
			this.getEmail();
			this.getHot();
			this.getUser();
			this.getWord();
		},
})